<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Server_model extends CI_Model {

	function __construct()
	{
		parent::__construct();
		$this->load->database();
	}
	public function add_new_server($server_name,$status) {
		$data = array (
				'server_name'=>$server_name,
				'status'=>$status
				);
		$this->db->insert('tbl_server',$data);
	}
	public function get_new_server() {
		$query = $this->db->query('SELECT * FROM tbl_server WHERE id = (SELECT MAX(id)  FROM tbl_server)');
		if($query->num_rows() > 0){
			$server = $query->result();
			return $server[0];
		}else{
			return null;
		}
		
	}
	public function get_server_list() {
		$this->db->order_by('id','desc');
		$query = $this->db->get('tbl_server');
		if($query->num_rows() > 0){
			return $query->result();
		}else{
			return null;
		}
		
	}
}